	//부킹탭
	function clsMyJoinInfoPartPart_Tab(){
		this.listData = null;
		this._HTMLDom = null;
		this._init();
	}
	
	clsMyJoinInfoPartPart_Tab.prototype = {
		_init: function(){
			var $layer = $("section#my_join_info_part section div.tab_menu ul li");			      
			this._HTMLDom = {
				"$layer": $layer	
			}
			$layer.removeClass("on1 on2 on3").eq(0).addClass("on1");			
		}	
		, $getBtnTab: function(){
			return this._HTMLDom["$layer"];	
		}
	}
	
	//부킹요약
	function clsMyJoinInfoPartPart_Info(){
		this.listData = null;
		this._HTMLDom = null;
		this._init();	
	}
	
	clsMyJoinInfoPartPart_Info.prototype = {
		_init: function(){
			var $layer = $("section#my_join_info_part section div.jo_table table tbody tr");
			this._HTMLDom = {
				"$layer": $layer	
			}
			$layer.find("td").html(0);
		}
		, setReserveConfirm: function(val){
			//예약완료			
			this._HTMLDom["$layer"].find("td:eq(0)").html(val)
		}
		, setPaymentWait: function(val){
			//보증결제대기
			this._HTMLDom["$layer"].find("td:eq(1)").html(val)
		}
		, setWaiting: function(val){
			//웨이팅예약
			this._HTMLDom["$layer"].find("td:eq(2)").html(val)
		}
	}
	
	//부킹목록
	function clsMyJoinInfoPartPart_List(){
		this.listData = null;
		this._HTMLDom = null;
		this._init();
	}
	
	clsMyJoinInfoPartPart_List.prototype = {
		_init: function(){
			var $layer = $("section#my_join_info_part section>ul.room_list");
			this._HTMLDom = {
				"$layer": $layer	
				, "$element": $layer.find(">li:first")
			}
			
			$layer.empty();
		}
		, setList: function(thisData){
			if(!this.listData) this.listData = [];			
			this.push(thisData);
		}
		, setReply: function(thisData){
			var n = thisData["인자값"]["인덱스"];
			
			this.listData[n]["댓글수"] = thisData["결과값"].length;
			this.listData[n]["댓글정보"] = thisData["결과값"];	
			
			var $layer = this._HTMLDom["$layer"];
			
			$layer.find(">li").eq(n).find("li.reply mark").html(this.listData[n]["댓글수"]);					
		}
		, push: function(thisData){
			var thisClass = this;
			var $element = this._HTMLDom["$element"];
			var $tmp = [];
		
			for(var i=0;i<thisData.length;++i){			
				
				$tmp.push($element.clone(true));
			
				$tmp[i].find("li.date").html(thisData[i]["날짜"] +"&nbsp;"+ thisData[i]["시간"]);
				$tmp[i].find("li.golf_c").html(thisData[i]["골프장코스명"]);
				if(!thisData[i]["비밀방"]){
					$tmp[i].find("li.key").html("");
				}
				$tmp[i].find("li.nickname mark").html(thisData[i]["부킹장"]["닉네임"]);
				//$tmp[i].find("li.reply mark").html(thisData[i]["부킹장"]["닉네임"]);				
				$tmp[i].find("li.state span").attr("class","").html("");
				if(thisData[i]["조인룸상태코드"]=="D"){
					//마감
					$tmp[i].find("li.state span").addClass("state_finish").html("마감");
				}else if(thisData[i]["조인룸상태코드"]=="E"){
					//조인완료
					$tmp[i].find("li.state span").addClass("state_ok").html("조인완료");
				}else if(thisData[i]["조인룸상태코드"]=="C"){
					//진행중
					$tmp[i].find("li.state span").addClass("state_ing").html("진행중");
				}
				thisClass.listData.push(thisData[i]);
			}			
			this.display($tmp);
		}
		, display: function(thisData){
			var $layer = this._HTMLDom["$layer"];
					
			for(var i=0;i<thisData.length;++i){
				$layer.append(thisData[i]);	
			}
		}
		, reset: function(){			
			this.listData = [];			
			this._HTMLDom["$layer"].empty();
		}
		, $getBtnMore: function(){			            
			return $("section#my_join_info_part>section div.btn_area div.btn_more");
		}
		, $getLayer: function(){
			return this._HTMLDom["$layer"];	
		}
		, getListCount: function(){
			if(!this.listData) return 0;
			return this.listData.length;
		}
	}
	
	//데이터연동		
	function clsComm_MyJoinInfoPart(){
		this.joinroomList = null;
		this.joinroomListRequest = null;
		this.joinroomListPageData = null;
		this.joinroom = null;
		this.joinroomApply = null;
		this.joinroomJoin = null;
		this._init();
	}	
	clsComm_MyJoinInfoPart.prototype = {
		_init: function(){
			this.joinroomListRequest = {
				"페이지": null	
			}
			this.joinroomListPageData = {
				"현재페이지": null
				, "전체수": null
				//, "페이지당수": 10
				//, "블럭당페이지": 1
			}
		}
//------------------------ 내가만든조인룸목록------------------------//
		, getJoinroomList: function(arg){
			var thisClass = this;
			var szPage = this.joinroomListRequest["페이지"];
			
			var objJson = new MJson();
        	var cm = new ConnectionManager();

			objJson.putClient("userid", _util.getLogin("아이디"));
        	objJson.putPub("sid", "US001");
        	objJson.putPub("servicename", "getMyJoinRoomParticipant");        	
        	objJson.putPub("listcount", 10);
			objJson.putPub("currpageno", szPage);
			      
        	cm.requestGet(objJson.getJsonString(), function(ret){
        		var items = ret["msp"]["contents"]["items"];
        		var totalCnt = 0
        		thisClass.joinroomList = [];
        		
				if(items){
					thisClass.joinroomListPageData["전체수"] = ret["msp"]["contents"]["@totalcount"];
															
					if(!items.length) items = new Array(items);
					for(var i=0;i<items.length;i++){
						var obj = items[i];
						
						thisClass.joinroomList.push({
							"조인룸코드": _util.nvl(obj["joinRoomSeq"])+""
							, "부킹장": {
								"아이디": _util.nvl(obj["bookUserId"])+""
								, "닉네임": _util.nvl(obj["nickName"])+""
								, "이미지": _util.nvl(obj["path"]) + _util.nvl(obj["saveFileNm"])+""
							}
							, "날짜": _util.nvl(obj["reserveDate"])
							, "시간": _util.nvl(obj["bookingTime"])+""
							, "요일": _util.nvl(obj["bookingDay"])+""
							, "골프장코스명": _util.nvl(obj["golfClubInfo"])+""
							, "홀": _util.nvl(obj["holeInfo"])+""
							, "내용": _util.nvl(obj["ment"])+""
							, "참여자": []
							, "신청자": []
							, "비밀방": (obj["openYn"] == "Y") ? false:true
							, "내상태코드": _util.nvl(obj["joinStatus"])+""
							, "조인룸상태코드": _util.nvl(obj["procStatus"])
							, "조인룸상태": _util.nvl(obj["procStatusNm"])+""
							, "초대인원":  _util.nvl(obj["invitCnt"], 0)
							, "댓글수": 0
							, "댓글목록": []
						});
					}
				}
			
				$(thisClass).trigger("evtFinishJoinroomList");
				
			}, function($err) {
				alert($err);
			});	
		}
		, getJoinroomListData: function(){
			return this.joinroomList;
		}
		, getJoinroomListPageData: function(){
			return this.joinroomListPageData;
		}
		, setJoinroomListRequest: function(key, val){
			this.joinroomListRequest[key] = val;
		}
		, getJoinroomListRequest: function(key){
			return this.joinroomListRequest[key];
		}
//------------------------ 내가만든조인룸목록------------------------//	
//------------------------ 조인룸댓글수------------------------//		
		, getJoinroomReply: function(arg){
			var thisClass = this;
			
			var objJson = new MJson();
        	var cm = new ConnectionManager();

			objJson.putClient("userid", _util.getLogin("아이디"));
        	objJson.putPub("sid", "JR001");
        	objJson.putPub("servicename", "getReplyList");        	
        	objJson.putPub("listcount", 99);
			objJson.putPub("currpageno", 1);
			
			objJson.putParameter("joinRoomSeq", arg["조인룸코드"]);
			     
        	cm.requestGet(objJson.getJsonString(), function(ret){
        		var items = ret["msp"]["contents"]["items"];
        		var listData = [];					
        		
				if(items){
					if(!items.length) items = new Array(items);
					for(var i=0;i<items.length;i++){
						var obj = items[i];
						var regDate = obj["regDate"] + "";
						var regTime = obj["regTime"] + "";
						
						listData.push({
							"댓글키": obj["replySeq"]
							, "내꺼여부": (obj["replyAuth"] == 0 ? true:false)
							, "내용": _util.enter2br(_util.nvl(obj["content"]))
							, "작성자": {
								"아이디": obj["regId"]
								, "닉네임": obj["nickName"]
								, "이미지": ""
							}
							, "작성일": regDate.substr(0, 4) + "." + regDate.substr(4,2) + "." + regDate.substr(6,2)
							, "작성시": regTime.substr(0, 2) + ":" + regTime.substr(2, 2)
						});
					}
				}
				
				var resData = {
					"결과값": listData
					, "인자값": arg	
				}
			
				$(thisClass).trigger("evtFinishJoinroomReply", resData);
				
			}, function($err) {
				alert($err);
			});	
		}
//------------------------ 조인룸댓글수------------------------//			
//------------------------ 내가만든조인룸------------------------//		 
		, getJoinroom: function(){
			var thisClass = this;
						
			var objJson = new MJson();
        	var cm = new ConnectionManager();

			objJson.putClient("userid", _util.getLogin("아이디"));
        	objJson.putPub("sid", "US001");
        	objJson.putPub("servicename", "getMyJoinroomCnt");        	
        	
        	cm.requestGet(objJson.getJsonString(), function(ret){
        		
				thisClass.joinroom = ret["msp"]["contents"]["items"];
				
				$(thisClass).trigger("evtFinishJoinroom");
				
			}, function($err) {
				alert($err);
			});			
		}
		, getJoinroomData: function(){
			return this.joinroom;
		}
//------------------------ 내가만든조인룸------------------------//
//------------------------ 참여신청------------------------//		
		, getJoinroomApply: function(){
			var thisClass = this;
						
			var objJson = new MJson();
        	var cm = new ConnectionManager();

			objJson.putClient("userid", _util.getLogin("아이디"));
        	objJson.putPub("sid", "US001");
        	objJson.putPub("servicename", "getMyJoinroomAsk");       
        	
        	cm.requestGet(objJson.getJsonString(), function(ret){
        		
				thisClass.joinroomApply = ret["msp"]["contents"]["items"];	
				
				$(thisClass).trigger("evtFinishtJoinroomApply");
				
			}, function($err) {
				alert($err);
			});
		}
		, getJoinroomApplyData: function(){
			return this.joinroomApply;
		}
//------------------------ 참여신청------------------------//		
//------------------------ 참여확정------------------------//		
		, getJoinroomJoin: function(){
			var thisClass = this;
						
			var objJson = new MJson();
        	var cm = new ConnectionManager();

			objJson.putClient("userid", _util.getLogin("아이디"));
        	objJson.putPub("sid", "US001");
        	objJson.putPub("servicename", "getMyJoinroomAskOk");        	
        
        	cm.requestGet(objJson.getJsonString(), function(ret){
        	
				thisClass.joinroomJoin = ret["msp"]["contents"]["items"];			
				
				$(thisClass).trigger("evtFinishtJoinroomJoin");
				
			}, function($err) {
				alert($err);
			});			
		}
		, getJoinroomJoinData: function(){
			return this.joinroomJoin;	
		}
//------------------------ 참여확정------------------------//		
	}
	
	//컨트롤파일
	function MyJoinInfoPart(){		
		this.objComm = null;			
		this.objMyJoinInfoPart_Tab = null;
		this.objMyJoinInfoPart_Info = null;
		this.objMyJoinInfoPart_List = null;
	};
	
	MyJoinInfoPart.prototype = {
	    onPageShow : function() {
	    	/*사용자 로그인체크
	    	if(!common.userCheck()){
	    		alert("로그인 후 사용하시기 바랍니다.");
	    		return;
	    	}
	    	*/	      	    	
	    	$("a").attr("href", "").attr("data-rel", "");	    	
	    	this._init();
	    }
	    , _init: function(){	    	
	    	
			this.objComm = new clsComm_MyJoinInfoPart();
	      	this.objMyJoinInfoPart_Tab = new clsMyJoinInfoPartPart_Tab();
			this.objMyJoinInfoPart_Info = new clsMyJoinInfoPartPart_Info();
			this.objMyJoinInfoPart_List = new clsMyJoinInfoPartPart_List();
	      	this.getParam();
	     
	     	this._role();
	     	
	      	this._bind();
	      	this._eventFinish();     	
	    }
	    , _start: function(){
	    	//예약현황 조회
	      	this.objComm.setJoinroomListRequest("페이지", 1);
	      	this.objComm.getJoinroomList();
	      	//this.spinStart();
	      	
	      	//내가만든조인룸 조회
	      	this.objComm.getJoinroom();
	      	//참여신청 조회
	      	this.objComm.getJoinroomApply();
	      	//참여확정 조회
	      	this.objComm.getJoinroomJoin();
	    }
	    , _eventFinish: function(){
	    	var thisClass = this;
	    	
	    	//예약현황 조회 완료 이벤트
		 	$(this.objComm).bind("evtFinishJoinroomList", function(event){
		 		var rows = thisClass.objMyJoinInfoPart_List.getListCount();
		 		var thisData = thisClass.objComm.getJoinroomListData();
		 		var totalCnt = thisClass.objComm.getJoinroomListPageData();
		 		
		 		thisClass.objMyJoinInfoPart_List.setList(thisData);
		 		thisClass.spinEnd();
		 		
		 		//조인룸 댓글정보 조회
		 		for(var i=0;i<thisData.length;++i){
		 			var submitData = {
		 				"조인룸코드": thisData[i]["조인룸코드"]
		 				, "인덱스": i	+rows
		 			}
		 			thisClass.objComm.getJoinroomReply(submitData);
		 		}
		 		
		 		//더보기 버튼 
		 		if(thisClass.objMyJoinInfoPart_List.getListCount() >= totalCnt["전체수"]) {
		 			thisClass.objMyJoinInfoPart_List.$getBtnMore().hide();
		 		}else {
		 			thisClass.objMyJoinInfoPart_List.$getBtnMore().show();
		 		}
		 	});
		 	
		 	//조인룸 댓글정보 조회 완료 이벤트
		 	$(this.objComm).bind("evtFinishJoinroomReply", function(event, resData){		 	
		 		thisClass.objMyJoinInfoPart_List.setReply(resData);
		 	});
		 	
		 	//내가만든조인룸 조회 이벤트
		 	$(this.objComm).bind("evtFinishJoinroom", function(event){
		 		var thisData = thisClass.objComm.getJoinroomData();		 		
		 		thisClass.objMyJoinInfoPart_Info.setReserveConfirm(thisData);
		 	});
		 	
		 	//참여신청 조회 이벤트
		 	$(this.objComm).bind("evtFinishtJoinroomApply", function(event){
		 		var thisData = thisClass.objComm.getJoinroomApplyData();
		 		thisClass.objMyJoinInfoPart_Info.setPaymentWait(thisData);
		 	});
		 	
		 	//참여확정 조회 이벤트
		 	$(this.objComm).bind("evtFinishtJoinroomJoin", function(event){
		 		var thisData = thisClass.objComm.getJoinroomJoinData();
		 		thisClass.objMyJoinInfoPart_Info.setWaiting(thisData);
		 	});
	    }
		 , _bind: function(){
		 	var thisClass = this;
		 	
		 	//탭클릭
		 	this.objMyJoinInfoPart_Tab.$getBtnTab().click(function(event){
		 		event.preventDefault();
		 		var n = thisClass.objMyJoinInfoPart_Tab.$getBtnTab().index($(this));
		 		var _url = "";
		 		switch(n){
		 			case 0 : _url = "join_info.html"; break;
		 			case 1 : _url = "join_info_part.html"; break;
		 		}
		 		$.mobile.changePage(_url,"slide",true);	
		 	});
		 	
		 	//상세보기
		 	this.objMyJoinInfoPart_List.$getLayer().on("click","a",function(event){
		 		event.preventDefault();
		 		var n = thisClass.objMyJoinInfoPart_List.$getLayer().find("a").index($(this));		 		
		 		_gf.joinRoomSeq = thisClass.objMyJoinInfoPart_List.listData[n]["조인룸코드"];		 				 		
		 		$.mobile.changePage("../room/join_room_view.html","slide",true);
		 	});
		 	
		 	//더보기
		 	this.objMyJoinInfoPart_List.$getBtnMore().click(function(event){
		 		var page = thisClass.objComm.getJoinroomListRequest("페이지");
		 		thisClass.objComm.setJoinroomListRequest("페이지",(page+1));
		 		thisClass.objComm.getJoinroomList();
		 		thisClass.spinStart();
		 	});
		 	
		 	//메뉴
		 	$("section#my_join_info_part nav ul li a:eq(0)").click(function(event){
		 		event.preventDefault();
		 		thisClass.goNavi();
		 	});
		 	
		 	//알림
		 	$("section#my_join_info_part nav ul li:eq(1)").click(function(event){
		 		event.preventDefault();
		 		$.mobile.changePage("../inc/info_booking.html","slide",true);	
		 	});
		 } 
		 , getParam: function(){
	    	
	    }
	    , _role: function(){
	    		if(!_util.getLogin("로그인")){
	    			//alert("로그인 후 이용하실 수 있습니다.");		    			
	    			this.goNavi();		
	    			return;    			
	    		}
    			
    			this._start();
	    		
	   }
		, goNavi: function(){
    		$.mobile.changePage("../inc/navi.html","slide",true);
		}
	    , spinStart: function(){		
			$.mobile.showPageLoadingMsg();			
		}
		, spinEnd: function(){			
	 		$.mobile.hidePageLoadingMsg();				
		}
	}